<?xml version="1.0" standalone="no"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" 
"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">

<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<title>Document</title>
	<script type="text/javascript" src="js/jquery-3.1.1.min.js"></script>
</head>
<body>

	<a href="javascript:void(0);" onclick="getCurrentTime('firefox');">获取播放时间</a>
	<a href="javascript:void(0);" onclick="playOrPaused('firefox',this);">播放</a>
	<a href="javascript:void(0);" onclick="hideOrShowControls('firefox',this);">隐藏控制框</a>
	<a href="javascript:void(0);" onclick="muted('firefox',this);">开启静音</a>
	<input type="button" value="+" id="upVol" onclick="vol('firefox' , 'up' , this )"/>
	<audio src="i/1.ogg" id="audio" controls="controls" ></audio>
	
<svg width="100%" height="100%" version="1.1"
xmlns="http://www.w3.org/2000/svg">

<polygon points="220,100 300,210 170,250"
style="fill:#cccccc;
stroke:#000000;stroke-width:1"/>

</svg>

	<script>
	var audio ;
	window.onload = function(){
	initAudio();
	}
	var initAudio = function(){
	//audio = document.createElement("audio")
	//audio.src='Never Say Good Bye.ogg'
	audio = document.getElementById('audio');
	}
	function getCurrentTime(id){ 
	alert(parseInt(audio.currentTime) + '：秒');
	}

	function playOrPaused(id,obj){
	if(audio.paused){
	audio.play();
	obj.innerHTML='暂停';
	return;
	}
	audio.pause();
	obj.innerHTML='播放';
	}

	function hideOrShowControls(id,obj){
	if(audio.controls){
	audio.removeAttribute('controls');
	obj.innerHTML = '显示控制框'
	return;
	}
	audio.controls = 'controls';
	obj.innerHTML = '隐藏控制框'
	return;
	}
	function vol(id,type , obj){
	if(type == 'up'){
	var volume = audio.volume + 0.1;
	if(volume >=1 ){
	volume = 1 ;

	}
	audio.volume = volume;
	}else if(type == 'down'){
	var volume = audio.volume - 0.1;
	if(volume <=0 ){
	volume = 0 ;
	}
	audio.volume = volume;
	}
	document.getElementById('nowVol').innerHTML = returnFloat1(audio.volume);
	}
	function muted(id,obj){
	if(audio.muted){
	audio.muted = false;
	obj.innerHTML = '开启静音';
	}else{
	audio.muted = true; 
	obj.innerHTML = '关闭静音';
	}
	}
	//保留一位小数点

	function returnFloat1(value) { 
	value = Math.round(parseFloat(value) * 10) / 10;
	if (value.toString().indexOf(".") < 0){
	value = value.toString() + ".0";
	}
	return value;
	}
	</script>
</body>
</html>